package com.tc.controller;


import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.tc.dto.NurseRecordDTO;
import com.tc.dto.OutwardDTO;
import com.tc.domain.Nurserecord;
import com.tc.service.NurserecordService;
import com.tc.service.OutwardService;
import com.tc.utils.ResultVo;
import com.tc.vo.NurseRecordsVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/nurserecord")
@Api(tags = "护理记录")
public class NurserecordController {
    @Autowired
    private NurserecordService nurserecordService;
    @Autowired
    private OutwardService outwardService;

    @ApiOperation("添加护理记录")
    @PostMapping("/addNurseRecord")
    public ResultVo addNurseRecord(Nurserecord nurserecord) throws Exception {
        return nurserecordService.addNurseRecord(nurserecord);
    }

    @GetMapping("/listNurseRecordsVo")
    @ApiOperation("客户护理记录信息动态查询（分页）")
    public ResultVo<Page<NurseRecordsVo>> listNurseRecordsVo(NurseRecordDTO nurseRecordDTO) throws Exception {
        return nurserecordService.queryNurseRecordsVo(nurseRecordDTO);
    }

    @GetMapping("/removeCustomerRecord")
    @ApiOperation("删除客户护理记录")
    public ResultVo removeCustomerRecord(Integer id) throws Exception {
        Nurserecord nurserecord = new Nurserecord();
        nurserecord.setIsDeleted(1);
        nurserecord.setId(id);
        nurserecordService.updateById(nurserecord);
        return ResultVo.ok("删除成功");
    }

    @ApiOperation("查询外出记录")
    @PostMapping("/queryOutwardVo")
    public ResultVo queryOutwardVo(OutwardDTO outwardDTO) throws Exception {
        return outwardService.queryOutwardVo(outwardDTO);
    }

}

